package 力扣._69_x的平方根;

class Solution {
    public int mySqrt(int x) {
        int l=0, r = x, mid=0;
         while(l<=r){
            mid = (l+r)/2;
            long t = (long) mid *mid;
            if( t == x)
                return mid;
            else if( t > x)
                r = mid-1;
            else
                l = mid+1;
         }
        return r;

    }

    public static void main(String[] args) {
        int i = new Solution().mySqrt(2147395599);
    }
}